using System;
using System.Windows.Forms;
using Eco.Windows.Forms;
using Eco.Handles;
using IDE;

namespace CommandEditor
{
	static class Program
	{
		private static IDEEcoSpace ecoSpace;

		/// <summary>
		/// The global EcoSpace instance.
		/// </summary>
        public static IDEEcoSpace EcoSpace
		{
			get { return ecoSpace; }
		}

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main()
		{
			Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault(false);
			WinFormDequeuer.Active = true;
			Form mainForm = null;
			try
			{
                var main_log = CommonClasses.Logger.LoggerManager.CreateOnce(".\\LoggerManager.ih.config", ".\\logs");

                ecoSpace = new IDEEcoSpace(main_log.GetLogger("CommandEditorLogger"));
                ecoSpace.Active = true;
				mainForm = new CommandEditorForm(ecoSpace);
			}
			catch (Exception e)
			{
				new ThreadExceptionDialog(e).ShowDialog();
				throw;
			}
			Application.Run(mainForm);
			ecoSpace.Dispose();
		}
	}
}
